fix: sync tab and pane titles when reopening renamed sessions from sidebar#344
Merged
Conversation
danshapiro
pushed a commit
that referenced
this pull request
May 17, 2026
added 3 commits
May 18, 2026 15:04
When openSessionTab or Sidebar.handleItemClick finds an existing tab for a session (via terminalId, findTabIdForSession, or findPaneForSession), update the tab title to match the session's current title from the sidebar. Previously only sessionMetadataByKey was updated, leaving the tab bar showing a stale provider name or directory name. The update is gated on !titleSetByUser to preserve user-manual tab renames.
…n reopen Gate the session-reopen title sync on hasTitle to prevent synthesized fallbacks (sessionId prefix, provider label) from overwriting meaningful auto-derived tab titles. Also sync paneTitles alongside tab.title in all three code paths so that stale runtime pane titles don't mask the updated tab display title. - Add hasTitle parameter to openSessionTab thunk - Gate all three existing-tab paths on hasTitle - Update all callers to pass hasTitle - Sync pane title via updatePaneTitle/updatePaneTitleByTerminalId - Add 7 unit tests + 2 e2e Sidebar dedup tests - Strengthen idempotency test with updatedAt assertion
… split-pane title sync - Fix sidebarSelectors pushFallbackItem: never set hasTitle=true for fallback items (local pane/tab titles are auto-generated, not real session renames). This prevents the clobbering class still reachable through normal sidebar-backed rows. - Fix indentation regression in Sidebar.tsx handleItemClick. - Walk pane tree in findTabIdForSession pane-title sync instead of only handling type==='leaf' (fixes split-layout gap). - Align pane-title sync preconditions across all three paths (require title truthiness in terminalId and Sidebar paths). - Update sidebarSelectors tests for new hasTitle=false semantics.
ba50e4b to
32cff19
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Restoring a session from the sidebar sometimes doesn't set the tab bar name to the sidebar's custom name, showing the provider label (e.g. "Claude") or directory name instead.
Root cause
Three code paths find existing tabs for a session but never sync the title:
openSessionTabterminalId pathopenSessionTabfindTabIdForSession pathSidebar.handleItemClickdedup viafindPaneForSessionpathFix
tab.titlein all three existing-tab paths, gated on!titleSetByUserto preserve user-manual tab renameshasTitleparameter to prevent synthesized fallback titles (session ID prefixes, provider labels) from overwriting auto-derived tab namespaneTitlesalongsidetab.titleso stale runtime pane titles don't mask the updated displaysidebarSelectorsto stop promoting local fallback titles tohasTitle=trueTests
tabsSlice.test.tscovering both thunk paths,hasTitlegating, pane title sync, and idempotencysidebar-click-opens-pane.test.tsxcovering Sidebar dedup path with title+pane sync andhasTitle=falsepreventiontitle-sync-flow.test.tsxcovering tab bar display after reopensidebarSelectors.test.tsfor new fallbackhasTitle=falsesemanticsReview history
hasTitlepromotion in fallback rows, split-pane gap, indentation regression